//多态1
class person{
    private String name;
    private int age;
    public person() {}
    public person(String name, int age) {
        this.name = name;
        this.age = age;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public int getAge() {
        return age;
    }
    public void setAge(int age) {
        this.age = age;
    }
    public void show(){
        System.out.println("人的信息为:"+name+","+age);
    }
}
class student extends person{
    public student() {}
    public student(String name, int age) {
        super(name, age);
    }
    @Override
    public void show() {
        System.out.println("学生的信息为:"+getName()+","+getAge());
    }
}
class teacher extends person{
    public teacher() {}
    public teacher(String name, int age) {
        super(name, age);
    }
    @Override
    public void show() {
        System.out.println("老师的信息为:"+getName()+","+getAge());
    }
}
class administrator extends person{
    public administrator() {}
    public administrator(String name, int age) {
        super(name, age);
    }
    @Override
    public void show() {
        System.out.println("管理员的信息为:"+getName()+","+getAge());
    }
}
public class A49 {
    public static void main(String[] args) {
        student p1 = new student("小王", 18);
        teacher p2 = new teacher("小李", 30);
        administrator p3 = new administrator("小张", 34);
		/*
		上面三段可以写成:
		person p1 = new student("小王", 18);
        person p2 = new teacher("小李", 30);
        person p3 = new administrator("小张", 34);
		*/
        register(p1);
        register(p2);
        register(p3);
    }
    public static void register(person p){
        p.show();
    }
}